home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / Manuels & Misc / Assembly / AOA.ZIP / CH06 / PRO6_4.ASM < prev    next >
Encoding:
Assembly Source File  |  1996-02-04  |  1.5 KB  |  72 lines

  1. ; PROJ6_4.ASM-
  2. ;
  3. ;    A PutString routine.  You are to write a subroutine that outputs the
  4. ;    zero terminated string pointed at by the ES:DI register pair.  Your
  5. ;    subroutine should preserve all registers it modifies.  It should *not*
  6. ;    print the zero terminating byte.
  7.  
  8.  
  9.  
  10. dseg        segment    para public 'data'
  11.  
  12. TestString    byte    "This is a test string to print", 0dh, 0ah, 0
  13. TSAdrs        dword    TestString
  14.  
  15.  
  16. ; Put any variables you need here.
  17. dseg        ends
  18.  
  19. cseg        segment    para public 'code'
  20.         assume    cs:cseg, ds:dseg
  21.  
  22.  
  23. ; PutChar prints the character in the AL register to the display.
  24.  
  25. PutChar        proc
  26.         push    ax        ;Preserve value in AH
  27.         mov    ah, 0eh        ;BIOS call to print a character.
  28.         int    10h
  29.         pop    ax        ;Restore AH's value.
  30.         ret
  31. PutChar        endp
  32.  
  33.  
  34.  
  35. ; Here is the routine you've got to write for this project:
  36. ; ES:DI points at the zero terminated string to print.
  37. ; Be sure to preserve all registers.
  38. ; You call call the PutChar routine to print the individual characters.
  39.  
  40. PutString    proc
  41.         ret
  42. PutString    endp
  43.  
  44.  
  45.  
  46.  
  47. ; Main program to test the PutString routine.
  48.  
  49. Main        proc
  50.         mov    ax, dseg
  51.         mov    ds, ax
  52.  
  53.  
  54.         les    di, TSAdrs    ;Load address of string into es:di
  55.         call    PutString
  56.  
  57.  
  58. Quit:        mov    ah, 4ch          ;DOS opcode to quit program.
  59.         int    21h        ;Call DOS.
  60. Main        endp
  61.  
  62. cseg        ends
  63.  
  64. sseg        segment    para stack 'stack'
  65. stk        byte    1024 dup ("stack   ")
  66. sseg        ends
  67.  
  68. zzzzzzseg    segment    para public 'zzzzzz'
  69. LastBytes    byte    16 dup (?)
  70. zzzzzzseg    ends
  71.         end    Main
  72.